package com.xd.dubbo.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.xd.dubbo.entity.UserEntity;
import com.xd.dubbo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("login")
public class LoginController {

    @Autowired
    DubboUserConsumer dubboUserConsumer;

    @Reference(check = false)
    UserService userService;

    @RequestMapping("login")
    boolean login(String account, String pwd){
//        return dubboUserConsumer.login(account, pwd);
        return userService.login(account, pwd);
    }

    @RequestMapping("insert")
    int insert() throws Exception {
        UserEntity userEntity = new UserEntity("666","666");
        return dubboUserConsumer.insert(userEntity);
    }

}
